<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
    <link rel="stylesheet" href="../lib/animate.min.css">
    <style>
        .ball{
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- <button type="button" @click="handle()">操作</button>
        <transition enter-active-class='animated zoomIn' leave-active-class='animated zoomOut'>
            <h3 v-if="flag">vue的动画是什么样</h3>
        </transition> -->

        <button type="button" @click="flag=!flag">操作</button>
        <transition
            v-on:before-enter="beforeEnter"
            v-on:enter="enter"
            v-on:after-enter="afterEnter"
            v-on:enter-cancelled=""
            v-on:before-leave=""
            v-on:leave=""
            v-on:after-leave=""
            v-on:leave-cancelled="">
            <div class="ball" v-if="flag"></div>
        </transition>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                flag: false
            },
            methods: {
                // el是原生dom对象
                beforeEnter(el){
                    el.style.transform = "translate(0,0)"
                },
                enter(el,done){
                    el.offsetWidth
                    el.style.transform = "translate(150px,450px)"
                    el.style.transition = "all 1s ease"
                    done();
                },
                afterEnter(el){
                    this.flag = !this.flag
                },
            },
            directives: {
                
            },
            filters: {
                
            }
        })

    </script>
</body>

</html>